﻿using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace SceneUnpacker.se.gno
{
    internal partial class AboutBox1
    {
        private IContainer components;
        private Label labelCompanyName;
        private Label labelCopyright;
        private Label labelProductName;
        private Label labelVersion;
        private PictureBox logoPictureBox;
        private Button okButton;
        private TableLayoutPanel tableLayoutPanel;
        private TextBox textBoxDescription;

        public AboutBox1 ()
        {
            this.InitializeComponent();
            this.Text = string.Format( "About {0}", this.AssemblyTitle );
            this.labelProductName.Text = this.AssemblyProduct;
            this.labelVersion.Text = string.Format( "Version {0}", this.AssemblyVersion );
            this.labelCopyright.Text = this.AssemblyCopyright;
            this.labelCompanyName.Text = this.AssemblyCompany;
            this.textBoxDescription.Text = this.AssemblyDescription;
        }

        public string AssemblyCompany
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( AssemblyCompanyAttribute ), false );
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ( (AssemblyCompanyAttribute)customAttributes[0] ).Company;
            }
        }

        public string AssemblyCopyright
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( AssemblyCopyrightAttribute ), false );
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ( (AssemblyCopyrightAttribute)customAttributes[0] ).Copyright;
            }
        }

        public string AssemblyDescription
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( AssemblyDescriptionAttribute ), false );
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ( (AssemblyDescriptionAttribute)customAttributes[0] ).Description;
            }
        }

        public string AssemblyProduct
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( AssemblyProductAttribute ), false );
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ( (AssemblyProductAttribute)customAttributes[0] ).Product;
            }
        }

        public string AssemblyTitle
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( AssemblyTitleAttribute ), false );
                if (customAttributes.Length > 0)
                {
                    AssemblyTitleAttribute attribute = (AssemblyTitleAttribute)customAttributes[0];
                    if (attribute.Title != "")
                    {
                        return attribute.Title;
                    }
                }
                return Path.GetFileNameWithoutExtension( Assembly.GetExecutingAssembly().CodeBase );
            }
        }

        public string AssemblyVersion
        {
            get
            {
                return Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
    }
}

